<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>酒店后台管理系统</title>
  <link rel="stylesheet" href="css/layui.css">
  <script src="js/jquery.min.js"></script>
  <script>
  function findmember(){
	  $.ajax({
			url:"/offline/member",
			type:"post",
			data:{
				mnumber:$("#mnumber").val(),
			},
			success:function(data){
				$("#osumprice").html(data.sumprice);
				$("#opledge").html(data.opledge);
				$("#ototalprice").html(data.totalprice);
			}
		})
		
		$("#incancle").click(function(){
			$.ajax({
				url:"/offline/cancle",
				type:"post",
				success:function(data){
					window.location.href="/html/offline.html";
				}
			})
		})
  }
 
  $(function(){
		var url = "ws://169.254.106.77:8080/WebSocketHandler/";
		var ws = null;
		//连接服务器
		var userName = $("#userName").val();
		url = url + userName; //传递用户名
		//创建对象，连接服务器
		ws=new WebSocket(url);
		//给ws对象绑定事件
		//连接事件
		ws.onopen = function(){
			console.info("连接服务器成功");
		}
		//接收到消息
		ws.onmessage = function(result){
			alert("你有一条待处理消息");
		}
		//关闭连接
		ws.onclose = function(){
			alert("断开连接");
		}
		
		$("#pass_message").click(function(){
			var message=$("#pass_message").val();
			alert(message);
			if(ws!=null){
				ws.send(message); //发送消息
			}
		})
		
		$("#nopass_message").click(function(){
			var message=$("#nopass_message").val();
			alert(message);
			if(ws!=null){
				ws.send(message); //发送消息
			}
		})
			
		//断开连接
		$("#cancel").click(function(){
			if(ws!=null){
				ws.close();
			}
		});	
	 })
	
  </script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">酒店后台管理系统</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
          贤心
        </a>
        <dl class="layui-nav-child">
          <!-- <dd><a href="">消息<span class="layui-badge">99+</span></a></dd> -->
        </dl>
      </li>
      <li class="layui-nav-item"><a href="logout">退了</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item layui-nav-itemed">
          <a class="" href="javascript:;">订单管理</a>
          <dl class="layui-nav-child">
            <dd><a href="/html/offline.html">线下开单</a></dd>
            <dd><a href="/checkin.html">线下开房</a></dd>
            <dd><a href="/html/checkout.html">宾客结账</a></dd>
            <dd><a href="/html/order.html">订单管理</a></dd>
          </dl>
        </li>
       <li class="layui-nav-item">
          <a href="javascript:;">营业查询</a>
          <dl class="layui-nav-child">
            <dd><a href="/selguest.html">入住宾客查询</a></dd>
            <dd><a href="/turnover.html">日/月营业查询</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">系统设置</a>
          <dl class="layui-nav-child">
            <dd><a href="/vip.html">VIP设置</a></dd>
        		<dd><a href="/discount.html">计费设置</a></dd>
        		<dd><a href="/room.html">房间设置</a></dd>
				<dd><a href="/admin.html">操作员设置</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item"><a href="/html/confirm.html">推送消息</a></li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body">
  <input type="hidden" id="userName" value="后台">
    <!-- 内容主体区域 -->
	<form class="layui-form" action="/offline/order">
		
		<div class="layui-order-message">
			订单编号：
			<div class="layui-input-inline" style="color: #9F9F9F;">
			 <label th:text="${order.onumber}"></label>
			</div>
			<hr class="layui-bg-green">
		</div>
		<div class="layui-form-item">
		  <div class="layui-inline">
				<label class="layui-form-label">入住时间</label>
				<div class="layui-input-inline" style="line-height: 35px; color: #9F9F9F;">
					<label th:text="${order.checkIn}"></label>
				</div>
		  </div>
		</div>
		
		<div class="layui-form-item">
		  <div class="layui-inline">
				<label class="layui-form-label">预退房时间</label>
				<div class="layui-input-inline" style="line-height: 35px; color: #9F9F9F;">
					<label th:text="${order.checkOut}"></label>
				</div>
		  </div>
		</div>
		
		<div class="table_class" style="width:1000px; margin-left: 50px;">
			<table class="layui-table" lay-skin="line">
				<colgroup>
					<col width="150">
					<col width="200">
					<col>
				</colgroup>
				<thead>
					<tr>
						<th style="width: 400px;">房间号</th>
						<th>金额</th>
						<th>入住人</th>
						<th>身份信息</th>
					</tr> 
				</thead>
				<tbody>
					<tr th:each="orderdetail : ${order.orderDetails}">
						<td th:text="${orderdetail.rid}" >
						<td th:text="${orderdetail.roomType.rprice}">
						<td th:text="${orderdetail.guest.gname}">
						<td th:text="${orderdetail.guest.gidcard}">
					</tr>
				</tbody>
			</table>
		</div>
	  
	 <div class="layui-form-item">
	    <label class="layui-form-label">会员编号</label>
	    <div class="layui-input-inline">
	      <input type="text" id="mnumber" lay-verify="identity" placeholder="请输入编号" autocomplete="off" class="layui-input">
	    </div>
	    <div class="layui-inline">
		  	<button type="button" class="layui-btn layui-btn-sm" style="margin-top: 5px" onclick="findmember()">确定</button>
		  </div>
	  </div>
	  
	  <div class="layui-form-item" style="margin-left: 700px;">
	    <label class="layui-form-label">房间总价</label>
	    <div class="layui-input-inline" style="font-size: 22px;line-height: 36px;color: rgb(205,0,0);">
	      ￥<label th:text="${order.sumprice}" id="osumprice"></label>
	    </div>
	  </div>
	  
	  <div class="layui-order-message">
	  	<hr class="layui-bg-green">
	  </div>
	  
	  <div class="layui-form-item" style="margin-left: 700px;">
	    <label class="layui-form-label">押金</label>
	    <div class="layui-input-inline" style="font-size: 22px;line-height: 36px;color: rgb(205,0,0);">
	      ￥<label th:text="${order.opledge}" id="opledge"></label>
	    </div>
	  </div>
	  
	  <div class="layui-form-item" style="margin-left: 700px;">
	    <label class="layui-form-label">实付</label>
	    <div class="layui-input-inline" style="font-size: 22px;line-height: 36px;color: rgb(205,0,0);">
	      ￥<label th:text="${order.totalprice}" id="ototalprice"></label>
	    </div>
	  </div>

	  
	  <div class="layui-form-item">
	    <div class="layui-input-block" style="margin-left: 800px;">
	      <button class="layui-btn" lay-submit="" lay-filter="demo1">结账</button>
	      <button type="reset" class="layui-btn layui-btn-primary" id="incancle">取消</button>
	    </div>
	  </div>
	</form>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © 版权归酒店所有
  </div>
</div>
<script src="layui.js"></script>
<script>
//JavaScript代码区域
layui.use('element', function(){
  var element = layui.element;
  
});
layui.use('laydate', function(){
	var laydate = layui.laydate;
});
</script>
</body>
</html>